Research
Security News
Threat Actor Exposes Playbook for Exploiting npm to Build Blockchain-Powered Botnets
A threat actor's playbook for exploiting the npm ecosystem was exposed on the dark web, detailing how to build a blockchain-powered botnet.
@smithy/middleware-endpoint
Advanced tools
[![NPM version](https://img.shields.io/npm/v/@smithy/middleware-endpoint/latest.svg)](https://www.npmjs.com/package/@smithy/middleware-endpoint) [![NPM downloads](https://img.shields.io/npm/dm/@smithy/middleware-endpoint.svg)](https://www.npmjs.com/packag
@smithy/middleware-endpoint is a middleware package for the AWS SDK for JavaScript (v3) that helps in resolving and customizing endpoints for service clients. It allows developers to modify endpoint resolution logic, making it easier to direct requests to different endpoints based on custom logic or configuration.
Custom Endpoint Resolution
This feature allows you to customize the endpoint resolution logic. In this example, the middleware modifies the request's hostname to a custom endpoint before passing it to the next middleware in the stack.
const { EndpointMiddleware } = require('@smithy/middleware-endpoint');
const { HttpRequest } = require('@smithy/protocol-http');
const customEndpointMiddleware = (next, context) => async (args) => {
const request = args.request;
if (HttpRequest.isInstance(request)) {
request.hostname = 'custom-endpoint.example.com';
}
return next({ ...args, request });
};
// Usage in a client configuration
const client = new SomeAWSClient({
region: 'us-west-2',
middlewareStack: [customEndpointMiddleware]
});
Conditional Endpoint Resolution
This feature allows you to conditionally resolve endpoints based on the operation being performed. In this example, the middleware changes the endpoint only for the 'GetItem' operation.
const { EndpointMiddleware } = require('@smithy/middleware-endpoint');
const { HttpRequest } = require('@smithy/protocol-http');
const conditionalEndpointMiddleware = (next, context) => async (args) => {
const request = args.request;
if (HttpRequest.isInstance(request) && context.operationName === 'GetItem') {
request.hostname = 'get-item-endpoint.example.com';
}
return next({ ...args, request });
};
// Usage in a client configuration
const client = new SomeAWSClient({
region: 'us-west-2',
middlewareStack: [conditionalEndpointMiddleware]
});
Axios is a promise-based HTTP client for the browser and Node.js. It allows you to intercept requests and responses, making it possible to modify endpoints and other request parameters. Compared to @smithy/middleware-endpoint, Axios is more general-purpose and not specifically tailored for AWS SDK.
Request is a simplified HTTP client for Node.js with support for various features like custom endpoints, redirects, and more. While it provides similar functionalities for modifying request parameters, it is not specialized for AWS SDK like @smithy/middleware-endpoint.
Got is a human-friendly and powerful HTTP request library for Node.js. It supports hooks that can be used to modify request options, including endpoints. Like Axios and Request, Got is a general-purpose HTTP client and not specifically designed for AWS SDK.
FAQs
[![NPM version](https://img.shields.io/npm/v/@smithy/middleware-endpoint/latest.svg)](https://www.npmjs.com/package/@smithy/middleware-endpoint) [![NPM downloads](https://img.shields.io/npm/dm/@smithy/middleware-endpoint.svg)](https://www.npmjs.com/packag
The npm package @smithy/middleware-endpoint receives a total of 15,595,129 weekly downloads. As such, @smithy/middleware-endpoint popularity was classified as popular.
We found that @smithy/middleware-endpoint demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 2 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Research
Security News
A threat actor's playbook for exploiting the npm ecosystem was exposed on the dark web, detailing how to build a blockchain-powered botnet.
Security News
NVD’s backlog surpasses 20,000 CVEs as analysis slows and NIST announces new system updates to address ongoing delays.
Security News
Research
A malicious npm package disguised as a WhatsApp client is exploiting authentication flows with a remote kill switch to exfiltrate data and destroy files.